class User {
	info = {};
	constructor(){
		this.init()
	}
	
	init(){
		const userInfo = uni.getStorageSync('userInfo');
		if(userInfo){
			this.setUser(JSON.parse(userInfo));
		}
	}

	setUser(data) {
		this.info = data;
	}

	getUser() {
		return this.info;
	}

	getNickName() {
		return this.info.nick;
	}
	getToken() {
		return this.info.token;
	}

	get(key) {
		return this.info[key];
	}
}

export default User;